package haoyou.csnf.manager.module.pm.dal.mysql.employeeeducations;

import java.util.*;

import haoyou.csnf.manager.framework.common.pojo.PageParam;
import haoyou.csnf.manager.framework.common.pojo.PageResult;
import haoyou.csnf.manager.framework.mybatis.core.query.LambdaQueryWrapperX;
import haoyou.csnf.manager.framework.mybatis.core.mapper.BaseMapperX;
import haoyou.csnf.manager.module.pm.dal.dataobject.employeeeducations.EmployeeEducationsDO;
import org.apache.ibatis.annotations.Mapper;
import haoyou.csnf.manager.module.pm.controller.admin.employeeeducations.vo.*;

/**
 * 职工学历 Mapper
 *
 * @author 好有经验源码
 */
@Mapper
public interface EmployeeEducationsMapper extends BaseMapperX<EmployeeEducationsDO> {

    default PageResult<EmployeeEducationsDO> selectPage(EmployeeEducationsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeEducationsDO>()
                .eqIfPresent(EmployeeEducationsDO::getEmpId, reqVO.getEmpId())
                .eqIfPresent(EmployeeEducationsDO::getEducation, reqVO.getEducation())
                .eqIfPresent(EmployeeEducationsDO::getDegree, reqVO.getDegree())
                .eqIfPresent(EmployeeEducationsDO::getStudyMode, reqVO.getStudyMode())
                .eqIfPresent(EmployeeEducationsDO::getSchool, reqVO.getSchool())
                .eqIfPresent(EmployeeEducationsDO::getMajor, reqVO.getMajor())
                .betweenIfPresent(EmployeeEducationsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EmployeeEducationsDO::getId));
    }
    default PageResult<EmployeeEducationsDO> selectPage(PageParam reqVO, Integer empId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeEducationsDO>()
                .eq(EmployeeEducationsDO::getEmpId, empId)
                .orderByDesc(EmployeeEducationsDO::getId));
    }
    default EmployeeEducationsDO selectByEmpId(Integer empId) {
        return selectOne(EmployeeEducationsDO::getEmpId, empId);
    }


    default int deleteByEmpId(Integer empId) {
        return delete(EmployeeEducationsDO::getEmpId, empId);
    }
    default int deleteByEmpId(Long empId) {
        return delete(EmployeeEducationsDO::getEmpId, empId);
    }

    default int deleteByEmpIds(List<Long> empIds) {
        return deleteBatch(EmployeeEducationsDO::getEmpId, empIds);
    }

}